package com.mm.cloud.sys.feign;

import com.mm.cloud.common.core.result.Result;
import com.mm.cloud.common.security.annotation.InnerAuth;
import com.mm.cloud.feign.sys.api.service.IUserFeignService;
import com.mm.cloud.feign.sys.api.vo.LoginUserVO;
import com.mm.cloud.sys.service.IUserService;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.RestController;

/**
 * 用户基础信息
 *
 * @author mr
 * @since 2023-04-20
 */
@AllArgsConstructor
@RestController
public class UserFeignApi implements IUserFeignService {

    /**
     * 用户基础信息
     */
    private final IUserService userService;

    /**
     * 查询用户
     *
     * @param username
     * @return
     */
    @InnerAuth
    @Override
    public Result<LoginUserVO> getUserByUsername(String username, String source) {
        return userService.getUserByUsername(username);
    }

    /**
     * 查询用户
     *
     * @param phone
     * @return
     */
    @InnerAuth
    @Override
    public Result<LoginUserVO> getUserByPhone(String phone, String source) {
        return userService.getUserByPhone(phone);
    }
}
